package cn.zjyj.module.zjyj.dal.mysql.riskassessmentrecord;

import cn.zjyj.framework.common.common.pojo.PageResult;
import cn.zjyj.framework.datasource.mybatis.core.query.LambdaQueryWrapperX;
import cn.zjyj.framework.datasource.mybatis.core.mapper.BaseMapperX;
import cn.zjyj.module.zjyj.dal.dataobject.riskassessmentrecord.RiskAssessmentRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.zjyj.module.zjyj.controller.admin.riskassessmentrecord.vo.*;

/**
 * 风险评估记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface RiskAssessmentRecordMapper extends BaseMapperX<RiskAssessmentRecordDO> {

    default PageResult<RiskAssessmentRecordDO> selectPage(RiskAssessmentRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RiskAssessmentRecordDO>()
                .betweenIfPresent(RiskAssessmentRecordDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RiskAssessmentRecordDO::getApplyRecordId, reqVO.getApplyRecordId())
                .eqIfPresent(RiskAssessmentRecordDO::getIdentifyId, reqVO.getIdentifyId())
                .eqIfPresent(RiskAssessmentRecordDO::getIdentifyInstanceId, reqVO.getIdentifyInstanceId())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskTargetId, reqVO.getRiskTargetId())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskTarget, reqVO.getRiskTarget())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskTargetContentId, reqVO.getRiskTargetContentId())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskTargetContent, reqVO.getRiskTargetContent())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskDegree, reqVO.getRiskDegree())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskLevel, reqVO.getRiskLevel())
                .eqIfPresent(RiskAssessmentRecordDO::getFixedRiskLevel, reqVO.getFixedRiskLevel())
                .eqIfPresent(RiskAssessmentRecordDO::getRealRiskLevel, reqVO.getRealRiskLevel())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskTargetContentUnitId, reqVO.getRiskTargetContentUnitId())
                .likeIfPresent(RiskAssessmentRecordDO::getRiskTargetContentUnitName, reqVO.getRiskTargetContentUnitName())
                .eqIfPresent(RiskAssessmentRecordDO::getRiskTargetContentLeaderId, reqVO.getRiskTargetContentLeaderId())
                .eqIfPresent(RiskAssessmentRecordDO::getCheckCycle, reqVO.getCheckCycle())
                .eqIfPresent(RiskAssessmentRecordDO::getCheckCycleUnit, reqVO.getCheckCycleUnit())
                .eqIfPresent(RiskAssessmentRecordDO::getCheckContents, reqVO.getCheckContents())
                .orderByDesc(RiskAssessmentRecordDO::getId));
    }

}